package way.scripts.classDoc.segment;


import org.apache.commons.lang3.tuple.Pair;

import java.util.ArrayList;
import java.util.List;

/**
 * @author Haozhiqiang  {2021/12/7 13:55}
 */
public class CDClass extends AbstractNode {

    private static final String[] columns = {"描述", "备注"};
    private static final String[] lines = {"父类", "目的","属性", "方法"};

    private Pair<String, String> parent;

    private Pair<String, String> property;

    private List<Pair<String, String>> methods;

    private final List<CDMethod> methodList = new ArrayList<>();

    @Override
    public int getLevel() {
        return 3;
    }

    public static String[] getColumns() {
        return columns;
    }

    public static String[] getLines() {
        return lines;
    }

    public Pair<String, String> getParent() {
        return parent;
    }

    public void setParent(Pair<String, String> parent) {
        this.parent = parent;
    }

    public Pair<String, String> getProperty() {
        return property;
    }

    public void setProperty(Pair<String, String> property) {
        this.property = property;
    }

    public List<Pair<String, String>> getMethods() {
        return methods;
    }

    public void setMethods(List<Pair<String, String>> methods) {
        this.methods = methods;
    }

    public void addCDMethod(CDMethod method) {
        method.setParentIndex(getDocIndex());
        method.setSelfIndex(this.methodList.size() + 1);
        this.methodList.add(method);
    }
}
